package eventStrategies.physicalModel;

import model.IPhysicalDataModel;
import controller.IController;
import eventManager.AppEvent;
import eventStrategies.IEventResponse;
import events.ECodeEventList;
import events.physicalModel.GetItemListEvent;
import events.physicalModel.ReplyGetItemListEvent;

public class GetItemListStrategy extends IEventResponse {

	private IController controller;
	private IPhysicalDataModel physModel;
	
	public GetItemListStrategy(IController controller, IPhysicalDataModel physModel) {
		super(ECodeEventList.GET_ITEMLIST);
		this.controller = controller;
		this.physModel = physModel;
	}

	@Override
	public void execute(AppEvent event) {
		GetItemListEvent fullEvent = (GetItemListEvent) event;
		
		controller.processOutgoingEvent(new ReplyGetItemListEvent(fullEvent.sender, physModel.getItemList()));		
	}

}
